#!/bin/bash

# 1: running
# 0: stopped

for_loop() {
    for i in $a $b $c; do
        if [ $i -ne "0" ]; then
            i=1;
        else
            i=0;
        fi
    done
}

count_3() {
    count=`expr $a + $b + $c`
    if [ $count -eq 3 ]; then
        echo "1"; exit 0
    else
        echo "0"; exit 0
    fi
}

if [ -d "${CSX_PATH}" ]; then
    a=`ps -ef | grep -v grep | grep -c traffic_cop`
    b=`ps -ef | grep -v grep | grep -c traffic_manager`
    c=`ps -ef | grep -v grep | grep -c traffic_server`
    for_loop
    count_3
fi
